import page
from base.base import Base
from tools.get_log import GetLog
import time
log = GetLog.get_logger()


class PageAxaHomePage(Base):

    # 点击弹窗按钮
    def page_click_close_btn(self):
        self.base_click(page.axa_close_btn)

    # 选择城市
    def page_click_city(self, title, cname):
        self.base_click_element(title=title, cname=cname)

    # 输入车主姓名
    def page_input_personnelName(self, axa_personnelName):
        self.base_input(page.axa_personnelName, axa_personnelName)

    # 输入车牌
    def page_input_licenceNo(self, axa_licenceNo):
        time.sleep(1)
        self.base_input(page.axa_licenceNo, axa_licenceNo)

    def page_get_iframe(self):
        return self.base_iframe(page.axa_iframe)

    # 点击立即报价
    def page_click_q_sumbit(self):
        self.base_click(page.axa_q_submit)

    #  组合 业务
    def page_axa_homepage(self, title, cname, axa_personnelName, axa_licenceNo):
        log.info("正在执行请求报价操作 城市为:{},车主为:{},车牌为：{}".format(cname, axa_personnelName, axa_licenceNo))
        self.page_click_close_btn()
        self.page_click_city(title, cname)
        self.page_input_personnelName(axa_personnelName)
        self.page_input_licenceNo(axa_licenceNo)
        self.page_click_q_sumbit()